<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ page errorPage="/Error.jsp"%>
<%
	String sessionValidation = (String) session	.getAttribute("sessionValidation");
	if (!(("validSession").equals(sessionValidation))) {
		request.setAttribute("errorMessage", "Session Timeout!");
%>
<jsp:forward page="Login.jsp" />
<%
	}
%>

<%
	String userType = (String) session.getAttribute("userType");

	if (!("admin").equals(userType)) {
		request.setAttribute("errorMessage",
				"Authorization Failure : Unauthorized User");
%>
<jsp:forward page="Error.jsp" />
<%
	}
%>


<!-- BEANS DECLARATION -->
<jsp:useBean id="dbaseBean" scope="session"
	class="edu.uic.ids517.model.DatabaseAccessBean"></jsp:useBean>

<jsp:useBean id="dbmsUserBean" scope="session"
	class="edu.uic.ids517.model.DbLoginBean"></jsp:useBean>

<jsp:useBean id="dropTableBean" scope="session"
	class="edu.uic.ids517.model.DropTableBean"></jsp:useBean>

<%@ page import="java.util.List"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Drop Table</title>



</head>
<body background="images/image1.jpg">
	<center>
		<h1>
			<font size="8" color="white">UIC Data Mining Tool</font>
		</h1>
		<br /> <br /> <br /> <a href="mainMenu.jsp"><font size="6"
			color="white">Home</font></a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a
			href="dbAccess.jsp"><font size="6" color="white">Database
				Access</font></a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a
			href="dataMiningTool.jsp"><font size="6" color="white">Data
				Mining Tool</font></a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a
			href="LogOut.jsp"><font size="6" color="white">Logout</font></a> <br />
		<hr>
		<br />
	</center>

	<script type="text/javascript">
		function createTableFunction() {
			window.location.href = 'CreateTable.jsp';
		}
		function dropTableFunction() {
			window.location.href = 'dropTable.jsp';
		}
		function displayTableFunction() {
			window.location.href = 'displayTable.jsp';
		}
		function importTableFunction() {
			window.location.href = 'importTable.jsp';
		}
		function exportTableFunction() {
			window.location.href = 'exportTable.jsp';
		}
	</script>

	<%
		List<String> listOfTables = dbaseBean.tableList();
	%>
	<form action="DropTableServlet" method="post">
		<div>
			<div style="width: 20%; float: left;">
				<div>
					<center>
						<b><font size="5" color="white">DB Functions</font></b>
					</center>
				</div>
				<div>
					<center>
						<table style="width: 50%" align="center">
							<tr>
								<td><br></td>
							</tr>
							<tr>
								<td><input type="button" onClick="createTableFunction();"
									value="CREATE TABLE"></td>
							</tr>
							<tr>
								<td><br></td>
							</tr>
							<tr>
								<td><input type="button" onClick="" value="DROP TABLE"></td>
							</tr>
							<tr>
								<td><br></td>
							</tr>
							<tr>
								<td><input type="button" onClick="displayTableFunction();"
									value="DISPLAY TABLE"></td>
							</tr>
							<tr>
								<td><br></td>
							</tr>
							<tr>
								<td><input type="button" onClick="importTableFunction();"
									value="IMPORT TABLE "></td>
							</tr>
							<tr>
								<td><br></td>
							</tr>
							<tr>
								<td><input type="button" onClick="exportTableFunction();"
									value="EXPORT TABLE "></td>
							</tr>

						</table>
					</center>
				</div>
			</div>

			<!-- DIV 2 code -->
			<div style="width: 80%; float: left">
				<div>
					<center>
						<b><font size="5" color="white">DB Parameters</font></b>
					</center>

				</div>
				<div>
					<br> <br>
					<center>
						<table>

							<tr>
								<td align="center"><b><font size="4" color="white">SELECT
											A TABLE TO DROP :&nbsp;&nbsp;</font></b></td>
								<td><select name="tableName">
										<%
											int i;
											for (i = 0; i < listOfTables.size(); i++) {
										%>
										<option>
											<%=listOfTables.get(i)%>
										</option>
										<%
											}
										%>
								</select></td>
							</tr>
						</table>



						<br> <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input
							type="SUBMIT" value="DROP TABLE">
					</center>
				</div>
			</div>
		</div>



	</form>
</body>

</html>

